#include <bits/stdc++.h>
// 2025/02/06
// tag: 
// Author: Zhang Muen
using namespace std;

using int64 = int64_t;

int t, n, nums[101], dp[25001];
bool can[25001];

signed main()
{
    cin >> t;
    while (t--){
        cin >> n;
        for (int i = 1; i <= n; i++)
            cin >> nums[i];
        sort(nums + 1, nums + n + 1);
        memset(dp, 0, sizeof(dp));
        memset(can, 0, sizeof(can));
        dp[0] = 1;
        for (int i = 1; i <= n; i++){
            if (dp[nums[i]] != 0)
                can[nums[i]] = 1;
            for (int j = nums[i]; j <= nums[n]; j++)
                dp[j] += dp[j - nums[i]];
        }
        int cnt = 0;
        for (int i = 1; i <= n; i++)
            if (!can[nums[i]])
                cnt++;
        cout << cnt << endl;
    }
    return 0;
}